<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns:MSHelp="http://www.microsoft.com/MSHelp/" lang="en-us" xml:lang="en-us"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="DC.Type" content="reference">
<meta name="DC.Title" content="task_scheduler_observer Members">
<meta name="DC.subject" content="task_scheduler_observer">
<meta name="keywords" content="task_scheduler_observer">
<meta name="DC.Relation" scheme="URI" content="../../../reference/task_scheduler/task_scheduler_observer.htm">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="task_scheduler_observer_member">
<meta name="DC.Language" content="en-US">
<link rel="stylesheet" type="text/css" href="../../../intel_css_styles.css">
<title>task_scheduler_observer Members</title>
</head>
<body id="task_scheduler_observer_member">
 <!-- ==============(Start:NavScript)================= -->
 <script src="..\..\..\NavScript.js" language="JavaScript1.2" type="text/javascript"></script>
 <script language="JavaScript1.2" type="text/javascript">WriteNavLink(3);</script>
 <!-- ==============(End:NavScript)================= -->
<a name="task_scheduler_observer_member"><!-- --></a>

 
  <h1 class="topictitle1">task_scheduler_observer Members</h1>
 
  
  <div>
	 
<div class="tablenoborder"><table cellpadding="4" summary="" frame="border" border="1" cellspacing="0" rules="all"><span class="tabledesc">The following table provides additional information on the members
		  of this template class. 
		</span><thead align="left"> 
			 <tr> 
				<th class="cellrowborder" valign="top" width="33.89830508474576%" id="d117586e29">Member 
				</th>
 
				<th class="cellrowborder" valign="top" width="66.10169491525423%" id="d117586e32">Description 
				</th>
 
			 </tr>
</thead>
 
		  <tbody> 
			 <tr> 
				<td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d117586e29 "><span class="keyword">task_scheduler_observer()</span> 
				</td>
 
				<td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d117586e32 ">
				  <p>Constructs instance with observing
					 disabled.
				  </p>
 
				</td>
 
			 </tr>
 
			 <tr> 
				<td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d117586e29 "><span class="keyword">~task_scheduler_observer()</span>
				  
				</td>
 
				<td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d117586e32 ">
				  <p>Disables observing. Waits for extant
					 invocations of 
					 <samp class="codeph">on_scheduler_entry</samp> or 
					 <samp class="codeph">on_scheduler_exit</samp> to complete.
				  </p>
 
				</td>
 
			 </tr>
 
			 <tr> 
				<td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d117586e29 "><span class="keyword">void observe( bool state=true
					 )</span> 
				</td>
 
				<td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d117586e32 ">
				  <p>Enables observing if state is true;
					 disables observing if state is false.
				  </p>
 
				</td>
 
			 </tr>
 
			 <tr> 
				<td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d117586e29 "><span class="keyword">bool is_observing() const</span> 
				</td>
 
				<td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d117586e32 ">
				  <p><strong>Returns</strong>: True if observing is
					 enabled; false otherwise.
				  </p>
 
				</td>
 
			 </tr>
 
			 <tr> 
				<td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d117586e29 "><span class="keyword">virtual void on_scheduler_entry(
					 bool is_worker)</span> 
				</td>
 
				<td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d117586e32 ">
				  <p>
					 The task scheduler invokes this method once per each thread participating in TBB work
					 after enabling the observation and before it starts participating for the first time,
					 or before it executes the first task stolen after enabling the observation.
				  </p>
 
				  <p>The flag 
					 <samp class="codeph">is_worker</samp> is true if the thread was created by
					 the task scheduler; false otherwise.
				  </p>
 
				  <div class="Note"><h3 class="NoteTipHead">
					Note</h3>
					 <p>If a thread enables observing before
						spawning a task, it is guaranteed that the thread that executes the task will
						have invoked 
						<samp class="codeph">on_scheduler_entry</samp> before executing the
						task. 
					 </p>

				  </div> 
				  <p><strong>Effects</strong>: The default behavior does
					 nothing.
				  </p>
 
				</td>
 
			 </tr>
 
			 <tr> 
				<td class="cellrowborder" valign="top" width="33.89830508474576%" headers="d117586e29 "><span class="keyword">virtual void on_scheduler_exit( bool
					 is_worker )</span> 
				</td>
 
				<td class="cellrowborder" valign="top" width="66.10169491525423%" headers="d117586e32 ">
				  <p>The task scheduler invokes this method when
					 a thread stops participating in task scheduling, if observing is enabled. 
				  </p>
 
				  <div class="Note"><h3 class="NoteTipHead">
					Caution</h3>
					 <p>Sometimes 
						<samp class="codeph">on_scheduler_exit</samp> is invoked for a thread
						but not 
						<samp class="codeph">on_scheduler_entry</samp>. This situation can arise
						if a thread never steals a task.
					 </p>

				  </div> 
				  <div class="Note"><h3 class="NoteTipHead">
					Caution</h3>
					 <p>A process does not wait for the
						worker threads to clean up. Thus a process can terminate before 
						<samp class="codeph">on_scheduler_exit</samp> is invoked.
					 </p>

				  </div> 
				  <p><strong>Effects</strong>: The default behavior does
					 nothing.
				  </p>
 
				</td>
 
			 </tr>
 
			
		  </tbody>
 
		</table>
</div>
 
  </div>
 

<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong>&nbsp;<a href="../../../reference/task_scheduler/task_scheduler_observer.htm">task_scheduler_observer</a></div>
</div>
<div></div>

</body>
</html>
